package com.kotlin.flong.flow

import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.zip
import kotlinx.coroutines.runBlocking

/**
 * @Author:liangjl
 * @Date: 2020/7/11-20:25
 * @Eamil:jilongliang@sina.com
 * @Description:
 * Flow的组合
 */
fun main() = runBlocking<Unit> {

    var nums = (1..5).asFlow()
    var strs = flowOf("周伯通", "瑛姑", "一灯大师", "王重阳", "洪七公")

    //柯里化输出
    nums.zip(strs) { a, b ->
        "$a->$b"
    }.collect { println(it) }


}